<template>
  <div>
    <h2>登录</h2>
    <form @submit.prevent="handleLogin">
      <label>用户名：</label>
      <input type="text" v-model="username" />
      <label>密码：</label>
      <input type="password" v-model="password" />
      <button type="submit">登录</button>
    </form>
  </div>
</template>

<script setup>
//import****问题文件
//import****问题文件

const username = ref('');
const password = ref('');
const userStore = useUserStore();

const handleLogin = async () => {
  if (await userStore.login(username.value, password.value)) {
    // 登录成功，可进行页面跳转等操作
    console.log('登录成功');
  } else {
    console.log('登录失败');
  }
};
</script>